package BehavioralPatterns.Memento.Game;

public class GameRole {

  private int vit;
  private int def;

  public int getVit() {
    return vit;
  }

  public void setVit(int vit) {
    this.vit = vit;
  }

  public int getDef() {
    return def;
  }

  public void setDef(int def) {
    this.def = def;
  }

//  创建Memento，根据当前的vit和def
  public Memento createMemento(){
    return new Memento(vit,def);
  }

  public void recoverFromMemento(Memento memento){
    this.vit = memento.getVit();
    this.def = memento.getDef();
  }

  public void display(){
    System.out.println("当前的攻击力：" + this.vit + ",当前的防御力：" + this.def);
  }
}
